<template>
	<view class="container">
		<top-back-navbar position="fixed" title="我的钱包" background="" color="rgb(82, 123, 173)"></top-back-navbar>
		<view class="top_box">
			<view class="" @click="to_next_page('/pagesZA/qianbao/mingxi?type=credit2&r=api.index.get_za_mingxi_list&title=账户资金&hander=可用资金')">
				<view class="top">
					账户资金
				</view>
				<view class="center">
					￥{{price_data.credit2}}
				</view>
			</view>
			<view class="bottom">
				<view class="" @click="to_next_page('/pages/member/zfbPay/zfbPay')">
					充值
				</view>
				<view class="" @click="to_next_page('/pages/member/details/tx/txc')">
					提现
				</view>
			</view>
		</view>
		<view class="router_box">

			<view class="xm">

			</view>

			<view class="jb" @click="to_next_pages()">

			</view>

		</view>
		<view class="bottom_box">
			<view class="">
				总价值
			</view>
			<view class="" style="font-weight: 700;">
				￥{{price_data.wallet_zong}}
			</view>
		</view>
		<view class="table_box">
			<view class="title" style="color: #A6A5D0; font-size: 20px;font-weight: 800; margin-bottom: 15px;">
				项目钱包
			</view>
			<table>
				<tr class="title">
					<th >项目名称</th>
					<th >数量</th>
					<th >价值</th>
					<th style="width: 18vw;">操作</th>
				</tr>
				<tr v-for="item,index in price_data.wallet_list">
					<td>{{item.title}}</td>
					<td>{{item.num}}</td>
					<td>{{item.money}}</td>
					<td style="width: 18vw;">
						<view class="caozuo" @click="to_tixian(item)">
							提现
						</view>
					</td>
				</tr>
			</table>
		</view>
		<!-- <web-view :src="weburl"></web-view> -->
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				openid: "",
				price_data: {},
				weburl:''
			};
		},
		computed: {
			//状态栏高度

		},
		onShow: function() {
			uni.getStorage({
				key: 'openid',
				success: (res) => {
					this.openid = res.data
					// this.weburl=`http://easy.juxingqiansheng.com/#/pages/member/jibeiqianbao?openid=`+this.openid
					this.get_data()
				},
				fail: () => {
					uni.navigateTo({
						url: '../login/login'
					});
				}
			});
		},

		methods: {
		
			to_next_page(path){
				uni.navigateTo({
					url: path
				});
			},
			to_tixian(item){
				console.log(item.tx_type);
				var type = item.tx_type
				var index=-1
				if(type == 'za'){
					index='6'
				}
				if(type == 'gf'){
					index='2'
				}
				if(type == 'fly_egg'){
					index='3'
				}
				if(type == 'life'){
					index='5'
				}
				var urls = '/pages/member/details/tx/txc?type='+index
				uni.navigateTo({
					url:urls
				})
				
			},
			get_data() {
				var openid = this.openid
				var type = this.current + 1
				uni.request({
					url: this.$BASE_URL +
						'/index.php?i=2&c=entry&m=ewei_shopv2&do=mobile&r=member&app=1&openid=' +
						openid,

					success: res => {
						var data = res.data
						var code = data.error
						console.log(data);
						this.price_data = data
					},
					fail: () => {},
					complete: () => {
						uni.hideLoading();
					}
				});
			},
			to_next_pages(){
				uni.navigateTo({
					url:'/pages/member/qianbao_beifen'
				})
			}



		}
	}
</script>

<style lang="less">
	* {
		margin: 0;
		padding: 0;
	}

	page {
		height: 100vh;
		width: 100vw;

	}

	.container {
		height: 100vh;
		width: 100vw;
		background: url('/static/images/home/qianbao_bg.png') 0 0 no-repeat;
		padding: 10px 8px;
	}

	.top_box {
		background: url('/static/images/home/qianbao_header.png') 0 0 no-repeat;
		width: 100%;
		height: 144px;
		background-size: cover;
		color: #fff;
		background-size: 100% 100%;
		border: 1px solid transparent;

		.top {
			margin-top: 20px;
		}

		.center {
			font-size: 21px;
			line-height: 1;
			margin: 5px 0 10px;
			font-weight: 700;
		}

		view {
			width: 100%;
			text-align: center;
		}

		.bottom {
			display: flex;
			justify-content: space-between;
			padding: 0 26px;

			view {
				width: 109px;
				height: 31px;
				color: #515089;
				border-radius: 5px;
				font-size: 16px;
				background-color: #fff;
				font-weight: 700;
			}
		}
	}

	.router_box {
		width: 100%;
		display: flex;
		justify-content: space-between;
		margin-top: 20px;
		view {
			width: 48%;
			height: 46px;
			
		}

		.xm {
			background: url('/static/images/home/xiangmuqianbao.png')0 0 no-repeat;
			background-size: 100% 100%;
			
		}

		.jb {
			background: url('/static/images/home/jibeiqianbao.png')0 0 no-repeat;
			background-size: 100% 100%;
		}
	}
	.bottom_box{
		margin-top: 20px;
		background: url('/static/images/home/duihuanquan.png')0 0 no-repeat;
		width: 100%;
		    height: 83px;
		    background-size: 100% 100%;
		    color: #515089;
			text-align: center;
			display: flex;
			flex-wrap: wrap;
			justify-content: center;
			align-content: center;
			view{
				width: 100%;
			}
	}
	.table_box{
		margin-top: 20px;
		width: 100%;
		
		table{
			width: 100%;
			background-color: rgba(223, 223, 223, 0.3);
			.title{
				margin-bottom: 100px;
				
				
			}
			tr{
				height: 45px;
			}
			td{
				text-align: center;
			}
			.caozuo{
				background-color: #9D9BCC;
				border: 1px solid #f8f8f8;
				text-align: center;
				width:	100%;
				margin: 0 auto;
				height: 30px;
				line-height: 30px;
				border-radius: 5px;
				color: #fff;
				font-size: 12px;
			}
		}
	}

</style>